package com.kunsan.compose.widget

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp

@Composable
fun RegularControlActions(
    modifier: Modifier = Modifier,
    spaceBy: Dp? = null,
    actions: List<(@Composable () -> Unit)> = emptyList(),
) {
    Surface(
        modifier = modifier,
        color = Color.Transparent
    ) {
        LazyRow(
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = if (spaceBy != null) {
                Arrangement.spacedBy(space = spaceBy, alignment = Alignment.CenterHorizontally)
            } else {
                Arrangement.SpaceEvenly
            },
        ) {
            items(actions) { action ->
                action.invoke()
            }
        }
    }
}
